﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.XtraReports.UI;

public partial class Store_Manager_SM_RP_Stock : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            if (ASPxRadioButton1.Checked)
            {
                ReportViewer1.Report = CreateReport();
            }
            if (ASPxRadioButton2.Checked)
            {
                ReportViewer1.Report = CreateReport1();
            }
        }

    }

    XtraReport CreateReport()
    {

        Rpt_Sales report = new Rpt_Sales();
        report.startDate.Value = ASPxDateEdit1.Text;
        report.endDate.Value = ASPxDateEdit2.Text;
        report.CreateDocument();
        return report;




    }
    XtraReport CreateReport1()
    {
        Rpt_Phy_Stock report1 = new Rpt_Phy_Stock();

        DateTime dt = ASPxDateEdit1.Date;
        string dateformat = dt.Year + "-" + dt.Month + "-" + dt.Day + " " + "00:00:00.000";
        DateTime dt1 = ASPxDateEdit2.Date;
        string dateformat1 = dt.Year + "-" + dt.Month + "-" + dt.Day + " " + "00:00:00.000";
        report1.startDate.Value = dateformat;
        report1.endDate.Value = dateformat1;
        report1.CreateDocument();
        return report1;

    }
    
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {

        ReportViewer1.Report = CreateReport();
    }
    protected void ASPxRadioButton2_CheckedChanged(object sender, EventArgs e)
    {
        ASPxLabel2.Visible = true;
        //ASPxLabel3.Visible = true;
        ASPxDateEdit1.Visible = true;
        ASPxDateEdit2.Visible = true;
    }
    protected void ASPxRadioButton1_CheckedChanged(object sender, EventArgs e)
    {
        ASPxLabel2.Visible = true;
        //ASPxLabel3.Visible = true;
        ASPxDateEdit1.Visible = true;
        ASPxDateEdit2.Visible = true;
    }
    protected void ASPxButton1_Click(object sender, EventArgs e)
    {
        if (ASPxRadioButton1.Checked)
        {
            ReportViewer1.Report = CreateReport();
        }
        if (ASPxRadioButton2.Checked)
        {
            ReportViewer1.Report = CreateReport1();
        }
    }
}